import java.util.Scanner;
public class Test {
    int a[] = new int[10];
    int curNum = 0;
    public void add(int num) throws MyException {
        if(curNum >= 10) {
            throw new MyException("队列已经满了");
        }
        for (int i = 0; i < curNum; i++) {
            if (a[i] == num){
                throw new doubleNumException("");
            }
        }
        a[curNum] = num;
        curNum ++;
        System.out.println("num" + num + "插入成功");
    }

    public static void main(String[] args) {
        Test test = new Test();
        try {
            test.add(1);
            test.add(1);
        }catch (MyException e){
            System.out.println("操作失败");
        }
finally {

        }
    }
}
